VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} frmLabelConfig 
   Caption         =   "8 Inch Label Configuration"
   ClientHeight    =   7740
   ClientLeft      =   45
   ClientTop       =   585
   ClientWidth     =   9060
   OleObjectBlob   =   "frmLabelConfig.frx":0000
   StartUpPosition =   2  'CenterScreen
End
Attribute VB_Name = "frmLabelConfig"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

'----------------------------------------------------------------------------------
'Author: Domonic Grande emp# 396671
'Project Contributors: Kevin Martin, Victor Graves, Bruce Acomb and Heath Galbraith
'Date: April 14 2006
'Revised: Oct 26 2006
'Dependancies: Cafe1.AfterShipPackage,AfterShipMent, BeforeShip
'              frm.LabelConfig
'              Windows Registry
'              FdxZebra.dll  (see documentation)
'              Microsoft Scripting Runtime (set in Refs) (needed for FSO)
'Features: Customer Logo, up to 4 ref fields for ground and express,
'          optional barcode format for refs, 300 char message field, customer URL,
'          PickTicket and optional barcoded doc tabs
'
'**********************************************************************************
'CAUTION:
'THIS CODE SHOULD NOT BE CHANGED.  IT IS DESIGNED TO CREATE A CONSISTANT
'LABEL ENVIRONMENT ADDING MANY OF THE MOST REQUESTED FEATURES BY CUSTOMERS.
'BECAUSE THE HELP DESK CAN'T SEE THE LABEL TO TROUBLESHOOT, THE CODE THAT CREATES
'THE LABEL (SUBS (EplDocTabNO, EplDocTabYes, ZplDocTabNo, ZplDocTabYes)) SHOULD
'NOT BE CHANGED.  THE FEATUERS ADDED ARE APPROVED BY CLS.  ANY OTHER CHANGES TO THE
'LABEL WILL REQUIRE LABEL APPROVAL AND WILL BE CONSIDERED A 'CUSTOM LABEL'.  IF
'ANY CHANGES ARE MADE, THE CIC WILL BE THE ONLY SOURCE OF SUPPORT FOR THE CUSTOMER.
'**********************************************************************************
'
'
'Oct 13 2006:
'            ZPL printer support added (usb and com/par)
'Oct 26 2006:
'            Added PickTicket for both printers
'May 5 2007:
'            Added UCC128 (SSCC18) Barcode feature
'            Added Sort ID feature
'            Added word wrap for all printers
'            Fixed Dept Notes mismap for dot proc
'
'            Notes on UCC128:
'                            UCC128 / SSCC18 barcode is printed when the feature is
'                            selected on the config form and the COMPLETE UCC128
'                            barcode number is passed via the afterShip event.
'                            This code does not maintain the license plate,
'                            nor does it calculate the check diget.  It simply
'                            creates an appropriate barcode and the human readable
'                            number.  If a customer desires either of these things,
'                            they can be provided earlier in your code and the
'                            complete number passed in the afterShip event.
'
'Nov 14 2007:
'            Added Bed Bath & Beyond Vendor label
'
'            Notes:
'                  A public instance of the User Defined Type(udt) BedBathBeyond
'                 (m_udtBedBathBeyond) should be populated when recip data is
'                  gathered.  This data can also be gathered from screen in the
'                  BeforeShipPackage Event if the system is stand alone.  By
'                  populating this udt and selecting "Bed Bath & Beyond" from
'                  the FeatureSet combo box on the frmLableConfig the vendor info
'                  will print on the top 2 inches of an 8 inch label.  It is
'                  important to note that the 4 data elements in the udt must be
'                  complete and formatted according to Bed Bath & Beyond specs.
'                  This project ONLY addresses the printing of the label.  It does
'                  NOT put the Bed Bath & Beyond data in the correct ref fields.
'
' 2009-04-30, JFW, CA domestic Ground signature required.
' 2009-07-21, JFW
'
'----------------------------------------------------------------------------------

Option Explicit
'


Private Sub cboDocTabInfo_Change()
  '--------------------------------------------------------
  'Author: Domonic Grande emp# 396671
  'Desc: Looks at DocTab Combo and turns options on and off
  '      depending upon selection
  'Called From: Change Event, frmLabelConfig.cboDocTabInfo
  '--------------------------------------------------------
  
  On Error GoTo EH
  
    With cboDocTabInfo
        '---------------------------
        'Standard docTab, no Changes
        '---------------------------
        If .ListIndex = 0 Then
            txtDocRefCap1.Visible = False
            txtDocRefCap2.Visible = False
            txtDocRefCap1.Text = ""
            txtDocRefCap2.Text = ""
            lblDocCap.Visible = False
            lblDocFieldId.Visible = False
            lblDocCR.Visible = False
            lblDocTrack.Visible = False
        '--------------
        '1 barcode (CR)
        '--------------
        ElseIf .ListIndex = 1 Then
            lblDocCap.Visible = True
            lblDocFieldId.Visible = True
            txtDocRefCap1.Visible = True
            txtDocRefCap2.Visible = False
            txtDocRefCap2.Text = ""
            lblDocCR.Visible = True
            lblDocTrack.Visible = False
        '-----------------------
        '2 barcodes (CR) (TRACK)
        '-----------------------
        ElseIf .ListIndex = 2 Then
            lblDocCap.Visible = True
            lblDocFieldId.Visible = True
            txtDocRefCap1.Visible = True
            txtDocRefCap2.Visible = True
            lblDocCR.Visible = True
            lblDocTrack.Visible = True
        '---------------------------------
        'When in doubt, light up the world
        '---------------------------------
        Else
            lblDocCap.Visible = True
            lblDocFieldId.Visible = True
            txtDocRefCap1.Visible = True
            txtDocRefCap2.Visible = True
        End If
    End With
    
    Exit Sub
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "frmLabelConfig.cboDocTabInfo_Change"
    
End Sub

Private Sub cboLabelFeatureSet_Change()
'--------------------------------------------------------------
  'Author: Domonic Grande emp# 396671
  'Desc: Looks at PickTicket Combo and turns options on and off
  '      depending upon selection
  'Called From: Change Event, frmLabelConfig.cboLabelFeatureSet
  '------------------------------------------------------------
  On Error GoTo EH
   
   '---------------------------------------------------------
   '1 = PickTicket 'Yes'
   'If pickTicket is used, turn off everything but the doctab
   '---------------------------------------------------------
   If cboLabelFeatureSet.ListIndex <> 0 Then
        With frmLabelConfig
            .cmdFlashPrinter.Enabled = False
            .cmdTestPrinter.Enabled = False
            .cboLogo.Enabled = False
            .txtURL.Enabled = False
            .cboRefOptions.Enabled = False
            .cboRefFormat.Enabled = False
            .txtRefCap1.Enabled = False
            .txtRefCap2.Enabled = False
            .txtRefCap3.Enabled = False
            .txtRefCap4.Enabled = False
            .txtMessage.Enabled = False
        End With
    '------------------
    'Turn everything on
    '------------------
    Else
        With frmLabelConfig
            .cmdFlashPrinter.Enabled = True
            .cmdTestPrinter.Enabled = True
            .cboLogo.Enabled = True
            .txtURL.Enabled = True
            .cboRefOptions.Enabled = True
            .cboRefFormat.Enabled = True
            .txtRefCap1.Enabled = True
            .txtRefCap2.Enabled = True
            .txtRefCap3.Enabled = True
            .txtRefCap4.Enabled = True
            .txtMessage.Enabled = True
        End With
    End If
    
    '----------------------------------------------------
    'Make font size available only if sort id is selected
    '----------------------------------------------------
    If cboLabelFeatureSet.ListIndex = 2 Then
        cboSortFontSize.Visible = True
        lblSortFont.Visible = True
    Else
        cboSortFontSize.Visible = False
        lblSortFont.Visible = False
    End If
    
Exit Sub
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "frmLabelConfig.cboFeatureSet_Change"
End Sub

Private Sub cboLabelStock_Change()
  '-------------------------------------------------------------
  'Author: Domonic Grande emp# 396671
  'Desc: Looks at Label Stock Combo and turns options on and off
  '      depending upon selection
  'Called From: Change Event, frmLabelConfig.cboLabelStockInfo
  '-------------------------------------------------------------
   
   On Error GoTo EH
   
    
    With cboLabelStock
       '---------------------------------------
       '8", no doc.  Turn on the DocTab options
       '---------------------------------------
       If .ListIndex = 0 Then
            cboDocTabInfo.Visible = False
            lblDocSetup.Visible = False
            lblDocFieldId.Visible = False
            lblDocCap.Visible = False
            lblDocCR.Visible = False
            lblDocTrack.Visible = False
            lblDocTabLine.Visible = False
            txtDocRefCap1.Visible = False
            txtDocRefCap2.Visible = False
       '---------------------------------------------------
       '8" WITH doctab.  Look at doctab set up and light up
       'options depending on selection
       '---------------------------------------------------
       Else
            Select Case cboDocTabInfo.ListIndex
                '---------------
                'Standard DocTab
                '---------------
                Case 0, 5
                    cboDocTabInfo.Visible = True
                    lblDocSetup.Visible = True
                    lblDocFieldId.Visible = False
                    lblDocTabLine.Visible = True
                    lblDocCap.Visible = False
                    lblDocCR.Visible = False
                    lblDocTrack.Visible = False
                    txtDocRefCap1.Visible = False
                    txtDocRefCap2.Visible = False
                '---------------
                'cr barcode only
                '---------------
                Case 1
                    cboDocTabInfo.Visible = True
                    lblDocSetup.Visible = True
                    lblDocFieldId.Visible = True
                    lblDocCap.Visible = True
                    lblDocCR.Visible = True
                    lblDocTrack.Visible = False
                    lblDocTabLine.Visible = True
                    txtDocRefCap1.Visible = True
                    txtDocRefCap2.Visible = False
                '------------
                'cr and track
                '------------
                Case 2
                    cboDocTabInfo.Visible = True
                    lblDocSetup.Visible = True
                    lblDocFieldId.Visible = True
                    lblDocCap.Visible = True
                    lblDocCR.Visible = True
                    lblDocTrack.Visible = True
                    lblDocTabLine.Visible = True
                    txtDocRefCap1.Visible = True
                    txtDocRefCap2.Visible = True
                '---------------------------------
                'when in doubt, turn everything on
                '---------------------------------
                Case Else
                    cboDocTabInfo.Visible = True
                    lblDocSetup.Visible = True
                    lblDocFieldId.Visible = True
                    lblDocCap.Visible = True
                    lblDocCR.Visible = True
                    lblDocTrack.Visible = True
                    lblDocTabLine.Visible = True
                    txtDocRefCap1.Visible = True
                    txtDocRefCap2.Visible = True
                End Select
       End If
    End With
    
    
   Exit Sub
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "frmLabelConfig.cboLabelStock_Change"
    
End Sub




Private Sub cboRefOptions_Change()
    
  '------------------------------------------------------------
  'Author: Domonic Grande emp# 396671
  'Desc: Looks at RefOptions Combo and turns options on and off
  '      depending upon selection
  'Called From: Change Event, frmLabelConfig.cboRefOptions
  '------------------------------------------------------------
    
    
    On Error GoTo EH
    
    '------------------------------------------------
    'Turns on and off features depending on selection
    '------------------------------------------------
    With cboRefOptions
        '------
        '4 refs
        '------
        If .ListIndex = 0 Then
            lblFieldId.Visible = True
            lblCap.Visible = True
            lblCR.Visible = True
            lblPO.Visible = True
            lblINV.Visible = True
            lblDept.Visible = True
            txtRefCap1.Visible = True
            txtRefCap2.Visible = True
            txtRefCap3.Visible = True
            txtRefCap4.Visible = True
            txtMessage.Visible = False
            lblMessageCap.Visible = False
            txtMessage.Text = ""
        '----------------
        '2 refs & message
        '----------------
        ElseIf .ListIndex = 1 Then
            lblFieldId.Visible = True
            lblCap.Visible = True
            lblMessageCap.Visible = True
            lblCR.Visible = True
            lblPO.Visible = True
            txtMessage.Visible = True
            txtRefCap1.Visible = True
            txtRefCap2.Visible = True
            
            ' 2007-11-09, JFW, Allow for choice of ref, and take first 2 with caption
            txtRefCap3.Visible = True
            txtRefCap4.Visible = True
            lblINV.Visible = True
            lblDept.Visible = True
            
            txtRefCap3.Text = ""
            txtRefCap4.Text = ""
        '------------
        'Message only
        '------------
        ElseIf .ListIndex = 2 Then
            lblMessageCap.Visible = True
            txtMessage.Visible = True
            txtRefCap1.Visible = False
            txtRefCap2.Visible = False
            txtRefCap3.Visible = False
            txtRefCap4.Visible = False
            lblFieldId.Visible = False
            lblCap.Visible = False
            lblCR.Visible = False
            lblPO.Visible = False
            lblINV.Visible = False
            lblDept.Visible = False
            txtRefCap1.Text = ""
            txtRefCap2.Text = ""
            txtRefCap3.Text = ""
            txtRefCap4.Text = ""
        End If
    End With

Exit Sub
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "frmLabelConfig.cboRefOptions_Change"

End Sub



Private Sub cmdExit_Click()
'-----------------------------------------------
'Author: Domonic Grande
'Called from: frmLabelConfig.cmdExit click event
'Desc: Hides frmLabelConfig
'-----------------------------------------------
    
    On Error GoTo EH
    
    frmLabelConfig.Hide

Exit Sub
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "frmLabelConfig.cmdExit_Click"

End Sub

Private Sub cmdFlashPrinter_Click()
On Error GoTo EH
    
    '---------------------------------------------------------
    'Calls a sub in modLabel8 that stores a customer's logo in
    'the printer's memory
    '---------------------------------------------------------
    modLabel8.PrinterFlash

Exit Sub
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "frmLabelConfig.cmdFlashPrinter_Click"

End Sub

Private Sub cmdSave_Click()
  
  '------------------------------------------------------------------------
  'Author: Domonic Grande emp# 396671
  'Desc: Looks at options chosen on the config form and enables or disables
  '      depending upon selections
  'Called From: Button click even on form
  '------------------------------------------------------------------------
  
  
On Error GoTo EH

Dim blnError As Boolean

blnError = False
    
    '-----------------------------------------------------
    'If the pickTicket is used, turn everything off except
    'the doctab
    '-----------------------------------------------------
    If cboLabelFeatureSet.ListIndex <> 0 Then
        With frmLabelConfig
            .cmdFlashPrinter.Enabled = False
            .cmdTestPrinter.Enabled = False
            .cboLogo.Enabled = False
            .txtURL.Enabled = False
            .cboRefOptions.Enabled = False
            .cboRefFormat.Enabled = False
            .txtRefCap1.Enabled = False
            .txtRefCap2.Enabled = False
            .txtRefCap3.Enabled = False
            .txtRefCap4.Enabled = False
            .txtMessage.Enabled = False
        End With
    '------------------------------------------
    'If pickTicket not used, turn everything on
    '------------------------------------------
    Else
        With frmLabelConfig
            .cmdFlashPrinter.Enabled = True
            .cmdTestPrinter.Enabled = True
            .cboLogo.Enabled = True
            .txtURL.Enabled = True
            .cboRefOptions.Enabled = True
            .cboRefFormat.Enabled = True
            .txtRefCap1.Enabled = True
            .txtRefCap2.Enabled = True
            .txtRefCap3.Enabled = True
            .txtRefCap4.Enabled = True
            .txtMessage.Enabled = True
        End With
        '-------------------------
        'If logo, light up buttons
        '-------------------------
        With cboLogo
            If .ListIndex = 0 Then
                cmdFlashPrinter.Visible = True
                cmdTestPrinter.Visible = True
            Else
                cmdFlashPrinter.Visible = False
                cmdTestPrinter.Visible = False
            End If
        End With
            
        
        With cboRefOptions
            If .ListIndex = 0 Then
                '
            ElseIf .ListIndex = 1 Then
                '
            ElseIf .ListIndex = 2 Then
                If txtMessage.Text = "" Then
                    MsgBox "In Order to get a message caption on the label" & vbCrLf & _
                    " you must input data in the message caption field", vbInformation Or vbSystemModal, "Warning"
                End If
            End If
        End With
        
        
        '--------------------------------------------------------
        'Validate Label Stock, Printer Port and OS (all required)
        '--------------------------------------------------------
        With cboLabelStock
            If .ListIndex < 0 Then
                blnError = True
                MsgBox "You must select a label stock option", vbInformation Or vbSystemModal, "Warning"
            End If
        End With
        
        With txtUNC
            If Trim(.Text) = "" Then
                blnError = True
                MsgBox "You must set a printer UNC", vbInformation Or vbSystemModal, "Warning"
            End If
        End With
        
        With cboPrinterType
            If .ListIndex < 0 Then
                blnError = True
                MsgBox "You must select a printer type", vbInformation Or vbSystemModal, "Warning"
            End If
        End With
        
        If cboLabelFeatureSet.ListIndex = 2 Then
            If cboSortFontSize.ListIndex < 0 Then
                blnError = True
                MsgBox "You must select a font size when using the SortID feature", vbInformation Or vbSystemModal, "Warning"
            End If
        End If
        
    End If
        
        
        If blnError Then
            '----------------------------------------------------------------
            'if minimum fields on form are not filled out, don't dismiss form
            '----------------------------------------------------------------
        Else
            '--------------------------
            'save setting values to reg
            '--------------------------
            With Registry
                .SaveValue "CustomLabelKey", "LabelSortIdFontSizeValue", cboSortFontSize.ListIndex
                .SaveValue "CustomLabelKey", "LabelFeatureSetValue", cboLabelFeatureSet.ListIndex
                .SaveValue "CustomLabelKey", "LabelStockValue", cboLabelStock.ListIndex
                .SaveValue "CustomLabelKey", "PrinterTypeValue", cboPrinterType.ListIndex
                .SaveValue "CustomLabelKey", "PrinterNameValue", cboPrinters.Text
                .SaveValue "CustomLabelKey", "PrinterNameIndexValue", cboPrinters.ListIndex
                .SaveValue "CustomLabelKey", "LogoValue", cboLogo.ListIndex
                .SaveValue "CustomLabelKey", "UrlValue", txtURL.Text
                .SaveValue "CustomLabelKey", "UncValue", txtUNC.Text
                .SaveValue "CustomLabelKey", "RefOptionsValue", cboRefOptions.ListIndex
                .SaveValue "CustomLabelKey", "RefFormatValue", cboRefFormat.ListIndex
                .SaveValue "CustomLabelKey", "RefCaption1Value", txtRefCap1.Text
                .SaveValue "CustomLabelKey", "RefCaption2Value", txtRefCap2.Text
                .SaveValue "CustomLabelKey", "RefCaption3Value", txtRefCap3.Text
                .SaveValue "CustomLabelKey", "RefCaption4Value", txtRefCap4.Text
                .SaveValue "CustomLabelKey", "MessageValue", txtMessage.Text
                .SaveValue "CustomLabelKey", "DocTabInfoValue", cboDocTabInfo.ListIndex
                .SaveValue "CustomLabelKey", "DocRefCaption1Value", txtDocRefCap1.Text
                .SaveValue "CustomLabelKey", "DocRefCaption2Value", txtDocRefCap2.Text
                ' 2009-07-21, JFW
                .SaveValue "CustomLabelKey", "TDMPSValue", CStr(cbTDMPS.Value)
                ' 2011-02-16, JFW
                If Cafe1.Screen.GetMeter = "0088144" _
                Or Cafe1.Screen.GetMeter = "88144" _
                Or Cafe1.Screen.GetMeter = "188895" _
                Or Cafe1.Screen.GetMeter = "872115" _
                Or Windows.ComputerName = "CAN-00325000" Then
                    .SaveValue "CustomLabelKey", "RemoveAWB", CStr(True)
                End If
                ' .SaveValue "CustomLabelKey", "RemoveExtraLabel", CStr(cbTDMPS.Value)
            End With
        
        End If
        
    Exit Sub
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "frmLabelConfig.cmdSave_Click"
    
End Sub

Private Sub cmdTestPrinter_Click()
    On Error GoTo EH
    
    '--------------------------------------------------------------------
    'When a logo is stored in the thermal printers memory, this cmdButton
    'will print a label with a record of what is stored in Mem and a test
    'of any correctly stored logo's
    '--------------------------------------------------------------------
    modLabel8.PrinterTest

Exit Sub
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "frmLabelConfig.cmdTestPrinter_Click"

End Sub


Private Sub lblTypeHelp_Click()
'---------------------------------------------------
'Author: Domonic Grande
'Called from: frmLabelConfig.lblTypeHelp click event
'Desc: Displays a msgbox explaining feature
'---------------------------------------------------
    On Error GoTo EH
    '----------------------------------------------------------------------------------
    'Just a label with an msgbox to help someone determine which printer type to choose
    '----------------------------------------------------------------------------------
    MsgBox "Printer type refers to the language your printer uses.  Please look" & vbCrLf & _
           " at your printer's model number and contact support if you're unsure" & vbCrLf & _
           "which option to choose.", vbInformation Or vbSystemModal, "Printer Type"
Exit Sub
EH:
        MsgBox Err.Description & vbCrLf & Err.Number, vbExclamation Or vbSystemModal, "frmLabelConfig.lblTypeHelp"
End Sub

Private Sub UserForm_Activate()
'-----------------------------------------------
'Author: Domonic Grande
'Called from: frmLabelConfig form activate event
'Desc: Displays correct settins on form based
'      upon any settings placed in reg from
'      previous use
'-----------------------------------------------


On Error GoTo EH

    Dim objFSO As FileSystemObject
    Set objFSO = New FileSystemObject
    
    '-------------------------------------------------------
    'If needed Folder and sub not created, use fso to create
    '-------------------------------------------------------
    With objFSO
        If Not .FolderExists("C:\LabelTemp") Then
            .CreateFolder ("C:\LabelTemp")
            .CreateFolder ("C:\LabelTemp\Logo")
        End If
    End With
    
    Dim objPrinter As IPrinter
    '-------------------------------------------------
    'load a combo box with all instlled printers on pc
    '-------------------------------------------------
    cboPrinters.Clear
    For Each objPrinter In Printers
        cboPrinters.AddItem objPrinter.DeviceName
    Next objPrinter
    
    '------------------
    'Choose feature set
    '------------------
    With frmLabelConfig.cboLabelFeatureSet
        .Clear
        .AddItem "Refs, Message & Logo", 0
        .AddItem "PickTicket", 1
        .AddItem "SortID", 2
        .AddItem "SSCC18", 3
        .AddItem "Bed Bath & Beyond", 4
        .AddItem "Signature Required", 5
        ' 2009-07-21, JFW
        .AddItem "Canada Custom DocTab", 6
    End With
    '----------------------------
    'Pick font for sortID feature
    '----------------------------
    With frmLabelConfig.cboSortFontSize
        .Clear
        .AddItem "2 inch font (5 chars)", 0
        .AddItem "1 inch font (12 chars)", 1
    End With
    
    '------------------
    'Choose label stock
    '------------------
    With frmLabelConfig.cboLabelStock
        .Clear
        .AddItem "8 inch NO doctab", 0
        .AddItem "8 inch WITH doctab", 1
    End With
    '---------------
    'Logo, yes or no
    '---------------
    With frmLabelConfig.cboLogo
        .Clear
        .AddItem "Yes", 0
        .AddItem "No", 1
    End With
    '------------------------
    'Ref options (label body)
    '------------------------
    With frmLabelConfig.cboRefOptions
        .Clear
        .AddItem "4 Ref Fields", 0
        .AddItem "2 Ref Fields & Message", 1
        .AddItem "Message only", 2
    End With
    '-----------------------
    'Ref format (label body)
    '-----------------------
    With frmLabelConfig.cboRefFormat
        .Clear
        .AddItem "Human Readable", 0
        .AddItem "Barcode only", 1
        .AddItem "Both", 2
    End With
    '------------------
    'Epl or Zpl printer
    '------------------
    With frmLabelConfig.cboPrinterType
        .Clear
        .AddItem "Epl (Old Style)", 0
        .AddItem "Zpl (New Style)", 1
    End With
    '------------------------------------------
    'config for doctab (standard, 1 bcode or 2)
    '------------------------------------------
    With frmLabelConfig.cboDocTabInfo
        .Clear
        .AddItem "Standard", 0
        .AddItem "One Barcode", 1
        .AddItem "Two Barcodes", 2
        .AddItem "Left Barcode", 3
        .AddItem "Right Barcode", 4
        .AddItem "FXI Custom", 5
    End With
    
    With frmLabelConfig
        '-----------------------------------------------------------------------
        'prevents code from trying to load settings before they have been stored
        '-----------------------------------------------------------------------
        If Trim(Registry.GetValue(fsiDefault, "CustomLabelKey", "LabelStockValue")) <> "" Then
            On Error Resume Next
            .cboSortFontSize.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "LabelSortIdFontSizeValue")
            .cboLabelFeatureSet.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "LabelFeatureSetValue")
            .cboLabelStock.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "LabelStockValue")
            .cboPrinterType.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "PrinterTypeValue")
            .cboPrinters.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "PrinterNameIndexValue")
            .cboLogo.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "LogoValue")
            .cboRefOptions.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "RefOptionsValue")
            .cboRefFormat.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "RefFormatValue")
            .cboDocTabInfo.ListIndex = Registry.GetValue(fsiDefault, "CustomLabelKey", "DocTabInfoValue")
            .txtURL.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "UrlValue")
            .txtUNC.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "UncValue")
            .txtRefCap1.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "RefCaption1Value")
            .txtRefCap2.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "RefCaption2Value")
            .txtRefCap3.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "RefCaption3Value")
            .txtRefCap4.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "RefCaption4Value")
            .txtMessage.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "MessageValue")
            .txtDocRefCap1.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "DocRefCaption1Value")
            .txtDocRefCap2.Text = Registry.GetValue(fsiDefault, "CustomLabelKey", "DocRefCaption2Value")
            ' 2009-07-21, JFW
            .cbTDMPS.Value = CBool(Registry.GetValue(fsiDefault, "CustomLabelKey", "TDMPSValue"))
            On Error GoTo EH
    End If
    End With
   
    With cboLabelStock
       '-------------------------------------
       'if no docTab, turn off doctab on form
       '-------------------------------------
       If .ListIndex = 0 Then
            cboDocTabInfo.Visible = False
            lblDocSetup.Visible = False
            lblDocFieldId.Visible = False
            lblDocCap.Visible = False
            lblDocCR.Visible = False
            lblDocTrack.Visible = False
            lblDocTabLine.Visible = False
            txtDocRefCap1.Visible = False
            txtDocRefCap2.Visible = False
       '-----------------------------------------------------------
       'If docTab, turn everything on (depending on doctab setting)
       '-----------------------------------------------------------
       Else
            Select Case cboDocTabInfo.ListIndex
                '---------------
                'Standard DocTab
                '---------------
                Case 0, 5
                    cboDocTabInfo.Visible = True
                    lblDocSetup.Visible = True
                    lblDocFieldId.Visible = False
                    lblDocTabLine.Visible = True
                    lblDocCap.Visible = False
                    lblDocCR.Visible = False
                    lblDocTrack.Visible = False
                    txtDocRefCap1.Visible = False
                    txtDocRefCap2.Visible = False
                '-------
                'CR only
                '-------
                ' 2009-09-24, JFW, All on and barcode dependant on Caption
                Case 99 ' 1
                    cboDocTabInfo.Visible = True
                    lblDocSetup.Visible = True
                    lblDocFieldId.Visible = True
                    lblDocCap.Visible = True
                    lblDocCR.Visible = True
                    lblDocTrack.Visible = False
                    lblDocTabLine.Visible = True
                    txtDocRefCap1.Visible = True
                    txtDocRefCap2.Visible = False
                '------------
                'CR and Track
                '------------
                Case 2
                    cboDocTabInfo.Visible = True
                    lblDocSetup.Visible = True
                    lblDocFieldId.Visible = True
                    lblDocCap.Visible = True
                    lblDocCR.Visible = True
                    lblDocTrack.Visible = True
                    lblDocTabLine.Visible = True
                    txtDocRefCap1.Visible = True
                    txtDocRefCap2.Visible = True
                '---------------------------------
                'when in doubt, turn everything on
                '---------------------------------
                Case Else
                    cboDocTabInfo.Visible = True
                    lblDocSetup.Visible = True
                    lblDocFieldId.Visible = True
                    lblDocCap.Visible = True
                    lblDocCR.Visible = True
                    lblDocTrack.Visible = True
                    lblDocTabLine.Visible = True
                    txtDocRefCap1.Visible = True
                    txtDocRefCap2.Visible = True
            End Select
       End If
    End With
    
    '------------------------------------------------------------
    'If pickTicket is used, turn everything off except the docTab
    '------------------------------------------------------------
    If cboLabelFeatureSet.ListIndex <> 0 Then
        With frmLabelConfig
            .cmdFlashPrinter.Enabled = False
            .cmdTestPrinter.Enabled = False
            .cboLogo.Enabled = False
            .txtURL.Enabled = False
            .cboRefOptions.Enabled = False
            .cboRefFormat.Enabled = False
            .txtRefCap1.Enabled = False
            .txtRefCap2.Enabled = False
            .txtRefCap3.Enabled = False
            .txtRefCap4.Enabled = False
            .txtMessage.Enabled = False
        End With
    '------------------------------------
    'If no pickTicket, turn everything on
    '------------------------------------
    Else
        With frmLabelConfig
            .cmdFlashPrinter.Enabled = True
            .cmdTestPrinter.Enabled = True
            .cboLogo.Enabled = True
            .txtURL.Enabled = True
            .cboRefOptions.Enabled = True
            .cboRefFormat.Enabled = True
            .txtRefCap1.Enabled = True
            .txtRefCap2.Enabled = True
            .txtRefCap3.Enabled = True
            .txtRefCap4.Enabled = True
            .txtMessage.Enabled = True
        End With
    End If
   
   Exit Sub
   
   
Release:
    '---------
    'clear fso
    '---------
    Set objFSO = Nothing
    '-----------------
    'clear printer obj
    '-----------------
    Set objPrinter = Nothing
    
  
EH:
  MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description, vbCritical _
  Or vbSystemModal, "UserForm_Activate"
  Resume Release
   
End Sub


